﻿@{
    Layout = null;
}
<link href="~/Scripts/Bootstrap/css/bootstrap-select.min.css" rel="stylesheet" />
<link href="~/Scripts/Bootstrap/css/bootstrap-datepicker3.min.css" rel="stylesheet" />

<script src="~/Scripts/Bootstrap/js/bootstrap-datepicker.js"></script>
<script src="~/Scripts/Bootstrap/js/bootstrap-select.js"></script>
<script src="~/Scripts/MGJJS/CodeManage/RawCode.js"></script>

@*limitUpd
limitDel
limitAdd*@

@*生码管理*@

<div class="mtlr15">
    <form id="SearchForm" role="form" onkeydown="if(event.keyCode==13){return false;}">
        <div class="row">
            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4" style="padding:0">
                <button type="button" limitupd class="btn btn-success" id="borncode" onclick="$.MGJ.RawCode.Dialog_BornCode()">
                    <i class="glyphicon glyphicon-plus-sign"></i>
                    生码
                </button>
                <button type="button" limitadd class="btn btn-success" id="able" onclick="$.MGJ.RawCode.Ajax_GetViewFlag(1)">
                    <i class="glyphicon glyphicon-plus-sign"></i>
                    启用
                </button>
                <button type="button" limitadd class="btn btn-success" id="enable" onclick="$.MGJ.RawCode.Ajax_GetViewFlag(0)">
                    <i class="glyphicon glyphicon-remove"></i>
                    禁用
                </button>
                <button type="button" limitadd class="btn btn-success" onclick="$.MGJ.RawCode.Execls('#RowCodeManage')">
                    <i class="glyphicon glyphicon-arrow-down"></i>
                    导出excel
                </button>
            </div>

            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
                @*<div class="input-group">
                    <div class="input-group-btn" style="margin-left:1px;" onclick="detailSearch(this)">
                        <button type="button" class="btn btn-default" style="border: 1px solid transparent;">
                            公司名称
                        </button>
                    </div>
                    <select id="EnterpriseBox" class="form-control selectpicker" data-live-search="true" data-live-search-placeholder="Search" data-actions-box="true" title="--请选择--" onchange=""></select>
                </div>*@
            </div>
          
            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
                <div class="input-group">
                    <div style="width:100%;display:none"></div>
                    <input type="text" class="form-control" placeholder="公司名称" id="EnterpriseName" name="EnterpriseName" onkeydown="if (event.keyCode == 13) { $.MGJ.RawCode.Ajax_GetRowCode(1); }" />
                    <span class="input-group-addon" onclick="$.MGJ.RawCode.Ajax_GetRowCode(1);">
                        <span class="glyphicon glyphicon-search"></span>
                    </span>
                    <div class="input-group-btn" style="margin-left:1px;" onclick="detailSearch(this)">
                        <button type="button" class="btn btn-default" style="border: 1px solid transparent;">
                            更多搜索
                            <span class="caret"></span>
                        </button>
                    </div>
                </div>
            </div>
        </div>
      
        <div class="detail-search-con" style="display:none">
            <div class="row newrow">
                <div class="col-lg-1 col-md-1 col-sm-1 col-lg-offset-1 col-md-offset-1 col-sm-offset-1 text-right" style="padding:0">
                    开始时间
                </div>
                <div class="col-lg-2 col-md-2 col-sm-2">
                    <input id="StartDate" type="text" name="StartDate" class="form-control" placeholder="开始时间" />
                </div>
                <div class="col-lg-1 col-md-1 col-sm-1 col-sm-2 text-right" style="padding:0">
                    结束时间
                </div>

                <div class="col-lg-2 col-md-2 col-sm-2 col-sm-3">
                    <input id="EndDate" type="text" name="EndDate" class="form-control" placeholder="结束时间" />
                </div>

            </div>
            <div class="row newrow">
                <div class="col-lg-1 col-md-1 col-sm-1 col-lg-offset-1 col-md-offset-1 col-sm-offset-1 text-right" style="padding:0">
                    生码批次
                </div>
                <div class="col-lg-2 col-md-2 col-sm-2">
                    <input type="text" name="Batch" class="form-control" placeholder="生码批次" />
                </div>
                <div class="col-lg-1 col-md-1 col-sm-1 col-sm-2 text-right" style="padding:0">
                    机构代码
                </div>

                <div class="col-lg-2 col-md-2 col-sm-2 col-sm-2">
                    <input type="text" name="Code" class="form-control" placeholder="机构代码" />
                </div>

                <div class="col-lg-2 col-md-2 col-sm-2 col-sm-2 text-center">
                    <button type="button" class="btn btn-default" style="margin-left:23px;" onclick="$.MGJ.RawCode.Ajax_GetRowCode(1);">
                        <span class="glyphicon glyphicon-search"></span>
                        搜索
                    </button>
                    <button type="reset" class="btn btn-default">
                        重置
                    </button>
                </div>
            </div>
        </div>
    </form>
    <div id="Table">
        <div class="overflow">
            <table class="table table-hover table-bordered">
                <thead>
                    <tr>
                        <th width="30px"><input type="checkbox" class="AllClickCheckbox"></th>
                        <th>公司名称</th>
                        <th>机构代码</th>
                        <th>生码批次</th>
                        <th>生码状态</th>
                        <th>是否启用</th>
                        <th>生码类型</th>
                        <th>生码数量</th>
                        <th>生码时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody id="RowCodeManage" style=" display:none;" binding="{'pageId':'ShoppingPager','pageCallback':'$.MGJ.RawCode.Ajax_GetRowCode','emptyHtml':Code_EmptyHtml}">
                    <tr>
                        <td><input type="checkbox" name="AllClickChild" class="AllClickChild" binding="{'value':'ID','flag':'ViewFlag'}"></td>
                        <td binding="{'text':'EnterpriseName','title':'EnterpriseName'}"></td>
                        <td binding="{'text':'Code'}"></td>
                        <td binding="{'text':'Batch'}"></td>

                        <td class="Status" binding="{'text':'Status','textHandle':$.MGJ.RawCode.Ajax_InitStatus}"></td>
                        <td class="ViewFlag" binding="{'text':'ViewFlag','textHandle':$.MGJ.RawCode.Ajax_ViewFlag}"></td>
                        <td class="CodeType" binding="{'text':'CodeType','textHandle':$.MGJ.RawCode.Ajax_handers}"></td>
                        <td binding="{'text':'Gen_Code_Nums'}"></td>

                        <td binding="{'text':'ChangeDate','textHandle':'datetime'}"></td>
                        <td>
                            <a limitupd binding="{'ID':'ID'}" onclick="$.MGJ.RawCode.Dialog_EditCode(this)">编辑</a>
                            <a limitadd binding="{'ID':'ID','PatchId':'PatchId','code':'Code','CodeType':'CodeType'}" onclick="$.MGJ.RawCode.Ajax_ExportCode(this)">下载</a>
                            @*<a limitdel binding="{'ID':'ID'}" onclick="$.MGJ.RawCode.Ajax_DelRowCode(this)">删除</a>*@
                            
                            @*<a binding="{'ID':'ID'}" onclick="$.MGJ.RawCode.Dialog_RawShowData(this)">详细数据</a>*@
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div id="ShoppingPager"></div>
    </div>

    
</div>

<script>
 
    //function EnterpriseBox() {
    //    $.ajax({
    //        type: "Get",
    //        url: "/CodeManage/SelEnterpriseBox",
    //        dataType: "json",
    //        success: function (data) {
    //            for (var i = 0; i < data.length ; i++) {
    //                $("#EnterpriseBox").append(" <option id='" + data[i].ID + "'>" + data[i].EnterpriseName + "</option>")
    //            }
    //            $('#EnterpriseBox').selectpicker();
    //        }
    //    })
    //}
    //EnterpriseBox()

    $("#StartDate").datepicker({
        format: "yyyy-mm-dd",
        language: 'cn',
        todayBtn: "linked",
        autoclose: true,
        todayHighlight: true,
        endDate: new Date()
    }).on('changeDate', function (e) {
        var startTime = e.date;
        $('#EndDate').datepicker('setStartDate', startTime);
    });
    $("#EndDate").datepicker({
        format: "yyyy-mm-dd",
        language: 'cn',
        todayBtn: "linked",
        autoclose: true,
        todayHighlight: true,
        endDate: new Date()
    }).on('changeDate', function (e) {
        var endTime = e.date;
        $('#StartDate').datepicker('setEndDate', endTime);
    });

    var ColspanNub = $(".table.table-hover.table-bordered").find("tr").children("td").length
    window.Code_EmptyHtml = '<tr><td colspan="' + ColspanNub + '"><p class="no-result">无符合条件的数据结果</p></td></tr>';

    $(function () {
        $.MGJ.RawCode.Ajax_GetRowCode(1);
    });

    $('#SearchForm').bootstrapValidator({
        fields: {
            Batch: {
                validators: {
                    regexp: {
                        regexp: /^[0-9]*$/,
                        message: '生码批次只能为数字'
                    }
                }
            },
            Code: {
                validators: {
                    regexp: {
                        regexp: /^[0-9]*$/,
                        message: '机构代码只能为数字'
                    }
                }
            }
        }
    })
</script>



